<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>网上报名系统</title>
  <!-- 引入 layui.css -->
  <link rel="stylesheet" href="<%=request.getContextPath()%>/component/layui27/css/layui.css">

  <style>
    .site-title {
      margin: 30px 0 20px;
    }
    .site-title fieldset {
      border: none;
      padding: 0;
      border-top: 2px solid #00589f;
    }
    .site-title fieldset legend {
      margin-left: 20px;
      padding: 0 10px;
      font-size: 22px;
      font-weight: 300;
    }
    .layui-inline{
      margin:10px 0px;
    }
    .layui-tab-brief>.layui-tab-title .layui-this{
      color:#00589f;
    }
    .layui-tab-brief>.layui-tab-more li.layui-this:after, .layui-tab-brief>.layui-tab-title .layui-this:after{
      border-bottom: 2px solid #00589f;
    }

  </style>
</head>
<body>

<div class="layui-fluid" style="padding:0px">
  <div class="layui-row">
    <img src="./images/banner.jpg" style="width: 100%;">
  </div>
</div >

<div  class="layui-fluid">
  <div class="layui-tab layui-tab-brief">
    <div style="margin: auto;display: flex;flex-wrap: wrap;justify-content: space-around;" class="layui-tab-brief">
      <ul class="layui-tab-title">
        <li class="">报名须知</li>
        <li <c:if test="${param.showTab ne 2}">class="layui-this"</c:if>>我要报名</li>
        <li class="">查询结果</li>
        <li <c:if test="${param.showTab eq 2}">class="layui-this"</c:if>>缴费流程</li>
      </ul>
    </div>

    <div class="layui-tab-content">
      <div class="layui-tab-item">

        <div style="max-width: 1104px; margin: 0px auto;">
          <h3 style="text-align: center;">
            <span style="font-size: 24px;">&nbsp;报名须知</span>
          </h3>
          <p><br></p>
          <p><span style="font-size: 24px;"></span></p>
          <p style="margin-bottom: 5px; line-height: 2em;"><span style="font-size: 18px;"><strong>1、网站于7月5日8:00正式启用，请同学和家长们认真填写相关信息，确保真实、准确、完整；</strong></span></p>
          <p style="margin-bottom: 5px; line-height: 2em;"><span style="font-size: 18px;"><strong>报名信息填报完成后，请及时关注网站“查询结果”，你可以查询到你的报名信息是否通过审核，通过审核后方可缴费。</strong></span></p>
          <p style="margin-bottom: 5px; line-height: 2em;"><span style="font-size: 18px;"><strong>3、只接受"支付宝赣服通"或微信“江西财政”公众号缴费，请按照缴费流程完成缴费，如不能缴费请与县（市区）负责老师联系。学生完成缴费，才算报名成功；</strong></span></p>
          <p style="margin-bottom: 5px; line-height: 2em;"><span style="font-size: 18px;"><strong>4、专业选择按缴费先后确定。如果你已经报名但未缴费，你所报专业可能会因为已经完成招生计划，而停止新增缴费，请你及时缴费。</strong></span></p>
          <p><br></p>
          <p style="line-height: 2em;"><span style="font-size: 20px;"><strong>温馨提示：7月5日8:00报名开始后，我们对报名情况进行复核，请完成报名并通过审核的新生，及时在缴费平台缴费。若超过48小时未及时缴费的学员，我们会进行一次电话提醒，还不及时缴纳费用的学员，我们会在通过审核后的第三天将学员信息记录在案并取消其报名资格。</strong></span></p>
          <p style="line-height: 2em;"><br></p>
        </div>

      </div>
      <div class="layui-tab-item  <c:if test="${param.showTab ne 2}">layui-show</c:if>">
        <form class="layui-form" action="<%=request.getContextPath()%>/BmRegistionServlet" method="post" id="ajaxForm" enctype = "multipart/form-data">

          <div class="layui-row site-title">
            <fieldset>
              <legend><a name="size">基础信息</a></legend>
            </fieldset>
          </div>

          <div class="layui-row">
            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                <font color="red">*</font>
                姓名</label>
              <div class="layui-input-block">
                <input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入姓名" class="layui-input">
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                <font color="red">*</font>
                民族</label>
              <div class="layui-input-block">
                <select id="nation" name="nation"></select>
                <script>
                    var nations = ["汉族", "蒙古族", "回族", "藏族", "维吾尔族", "苗族", "彝族", "壮族", "布依族", "朝鲜族", "满族", "侗族", "瑶族", "白族",
                        "土家族", "哈尼族", "哈萨克族", "傣族", "黎族", "傈僳族", "佤族", "畲族", "高山族", "拉祜族", "水族", "东乡族", "纳西族", "景颇族", "柯尔克孜族", "土族",
                        "达斡尔族", "仫佬族", "羌族", "布朗族", "撒拉族", "毛南族", "仡佬族", "锡伯族", "阿昌族", "普米族", "塔吉克族", "怒族", "乌孜别克族", "俄罗斯族", "鄂温克族",
                        "德昂族", "保安族", "裕固族", "京族", "塔塔尔族", "独龙族", "鄂伦春族", "赫哲族", "门巴族", "珞巴族", "基诺族"];
                    var option = "";
                    for(var i = 0; i <
                    nations.length; i++) {
                        option += '<option value="' + (i + 1) + '">' + nations[i] + '</option>';
                    }
                    document.getElementById("nation").innerHTML=option;
                </script>
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                <font color="red">*</font>
                身份证号</label>
              <div class="layui-input-block">
                <input type="text" name="idCard" id="idCard" lay-verify="identity" autocomplete="off" placeholder="请输入身份证号" class="layui-input" >
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3" style="display:none">
              <label class="layui-form-label">
                性别</label>
              <div class="layui-input-block">
                <input type="text" id="sex" name="sex" lay-verify="title" autocomplete="off" disabled placeholder="性别根据身份证号获取" class="layui-input">
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3"  style="display:none">
              <label class="layui-form-label">
                出生年月</label>
              <div class="layui-input-block">
                <input type="text" id="birthday" name="birthday" lay-verify="title" disabled autocomplete="off" placeholder="生日根据身份证号获取" class="layui-input">
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                学历</label>
              <div class="layui-input-block">
                <select name="xueli" id="xueli" lay-filter="xueli" lay-verify="required">
                  <option value="初中">初中</option>
                  <option value="中专">中专</option>
                  <option value="高中">高中</option>
                  <option value="中技">中技</option>
                  <option value="职高">职高</option>
                </select>
              </div>
            </div>


            <div class="layui-inline layui-col-sm12 layui-col-md3" id="zkfs_div">
              <label class="layui-form-label">
                <font color="red">*</font>
                中考分数</label>
              <div class="layui-input-block">
                <input type="number" name="score" id="score" lay-verify="required" autocomplete="off" placeholder="请输入分数" class="layui-input">
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                毕业省</label>
              <div class="layui-input-block">
                <select name="byProvince" id="byProvince" lay-filter="byProvince" lay-verify="required"></select>
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                毕业市</label>
              <div class="layui-input-block">
                <select name="byCity" id="byCity" lay-filter="byCity" lay-verify="required"></select>
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                毕业县</label>
              <div class="layui-input-block">
                <select name="byPrefecture" id="byPrefecture" lay-filter="byPrefecture" lay-verify="required"></select>
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                <font color="red">*</font>毕业学校</label>
              <div class="layui-input-block">
                <input list="schoolList" name="bySchool" id="bySchool" class="layui-input" lay-verify="required">
                <datalist id="schoolList">

                </datalist>
                <%--<select name="bySchool" id="bySchool" lay-filter="bySchool" lay-verify="required"></select>--%>
              </div>
            </div>


            <div class="layui-inline layui-col-sm12 layui-col-md3" id="bmxhdiv">
              <label class="layui-form-label">
                <font color="red">*</font>报考序号</label>
              <div class="layui-input-block">
                <input type="number" name="graduateNo" id="graduateNo" lay-verify="required" autocomplete="off" placeholder="请输入报考序号" class="layui-input">
              </div>
            </div>


            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label" id="fsjt">
                <font color="red">*</font>分数截图
                </label>
              <div class="layui-input-block">
                <input type="file" name="file" lay-verify="required" autocomplete="off"  class="layui-input">
              </div>
            </div>

          </div>
          <div class="layui-row site-title">
            <fieldset>
              <legend><a name="size">地址信息</a></legend>
            </fieldset>
          </div>
          <div class="layui-row">


            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                省</label>
              <div class="layui-input-block">
                <select name="province" id="province" lay-filter="province" lay-verify="required"></select>
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                市</label>
              <div class="layui-input-block">
                <select name="city" id="city" lay-filter="city" lay-verify="required"></select>
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                县</label>
              <div class="layui-input-block">
                <select name="prefecture" id="prefecture" lay-filter="prefecture" lay-verify="required"></select>
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                详细地址</label>
              <div class="layui-input-block">
                <input type="text" name="address" lay-verify="required" autocomplete="off" placeholder="请输入详细地址" class="layui-input">
              </div>
            </div>
          </div>

          <div class="layui-row site-title">
            <fieldset>
              <legend><a name="size">报读专业</a></legend>
            </fieldset>
          </div>
          <div class="layui-row">

            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                学校</label>
              <div class="layui-input-block">
                <select name="schoolId" id="schoolId" lay-filter="schoolId" lay-verify="required" required>
                  <option value="1">江西赣州技师学院</option>
                  <option value="2">赣州农业学校</option>
                </select>
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                层级</label>
              <div class="layui-input-block">
                <select name="levelId" id="levelId" lay-filter="levelId"  lay-verify="required" required>
                </select>
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                专业</label>
              <div class="layui-input-block">
                <select name="majorId" id="majorId" lay-filter="majorId" lay-verify="required" required>
                </select>
              </div>
            </div>
            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                联系人</label>
              <div class="layui-input-block">
                <label id="lxr" style="float: left;display: block;margin-top: 10px;font-weight: bold"></label>
              </div>
            </div>
          </div>

          <div class="layui-row site-title">
            <fieldset>
              <legend><a name="size">联系方式</a></legend>
            </fieldset>
          </div>
          <div class="layui-row">
            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                <font color="red">*</font>
                学生电话</label>
              <div class="layui-input-block">
                <input type="text" name="phone" lay-verify="phone" autocomplete="off" placeholder="请输入学生电话" class="layui-input">
              </div>
            </div>

            <div class="layui-inline layui-col-sm12 layui-col-md3">
              <label class="layui-form-label">
                <font color="red">*</font>
                家长电话</label>

              <div class="layui-input-block">
                <input type="text" name="pPhone" lay-verify="phone" autocomplete="off" placeholder="请输入家长电话" class="layui-input">
              </div>
            </div>

            <div class="layui-form-item layui-col-sm12 layui-col-md6">
              <div class="layui-inline"> <label class="layui-form-label">
                <font color="red">*</font>
                验证码</label>
                <div class="layui-input-inline" style="display: flex">
                  <input placeholder="验证码" lay-verify="required" name="vercode" hover
                         class="code layui-input layui-input-inline" style="margin: 0 0 10px 3px; width:150px"  />

                </div>
                <div class="layui-input-inline" style="display: flex">
                  <img src="<%=request.getContextPath()%>/system/captcha/generate" class="captchaImage" id="captchaImage" style="height: 36px;margin-left: 10px;"/>
                </div>
              </div>
              <div class="layui-inline">
                <div class="layui-input-inline">

                </div>
              </div>
            </div>

            <div class="layui-inline layui-col-sm6 layui-col-md6">



            </div>

          </div>
          <div class="layui-row">
            <div class="layui-col-md6" style="padding-right: 15px;margin-bottom: 20px;">
              <button lay-submit lay-filter="*" class="layui-btn layui-btn-radius layui-btn-fluid layui-btn-normal">提交报名</button>
            </div>
            <%--<div class="layui-col-md2">&nbsp;</div>--%>
            <div class="layui-col-md6" style="padding-right: 15px;">
              <button type="reset" class="layui-btn layui-btn-radius layui-btn-fluid layui-btn-primary">重新填写</button>
            </div>
          </div>
        </form>
      </div>
      <div class="layui-tab-item">
        <div class="layui-row">
          <div class="layui-col-md3 layui-col-md-offset2" style="padding-right: 15px;margin-bottom: 20px;">

            <label class="layui-form-label">
              <font color="red">*</font>
              身份证号</label>
            <div class="layui-input-block">
              <input type="text" name="searchIdcard" id="searchIdcard"  autocomplete="off" placeholder="请输入身份证号" class="layui-input">
            </div>
          </div>

          <div class="layui-col-md3" style="padding-right: 15px;margin-bottom: 20px;">
            <label class="layui-form-label">
              <font color="red">*</font>
              报名序号</label>
            <div class="layui-input-block">
              <input type="text" name="searchBmxh" id="searchBmxh"  autocomplete="off" placeholder="报名序号" class="layui-input">
            </div>
          </div>


          <%--<div class="layui-col-md2">&nbsp;</div>--%>
          <div class="layui-col-md2" style="padding-right: 15px;">
            <button onclick="searchBuild()" class="layui-btn layui-btn-radius layui-btn-fluid layui-btn-normal">查询</button>
          </div>
        </div>
        <br>
        <br>
        <div style="max-width: 1104px; margin: 0px auto;">
          <h3 style="text-align: center;">
            <span style="font-size: 24px; color:red;line-height:36px;">重要通知：部分专业已满额，等待审核的同学请尽快更换其他专业！！！</span>
          </h3>
          <h3 style="text-align: center;">
            <span style="font-size: 16px;line-height:24px;"><a href = "https://mp.weixin.qq.com/s/484gu5MXRWE9hTwWovDHCA" target="_blank">关于我院（赣州农业学校、江西赣州技师学院）部分专业招生录取情况的通告</a></span>
          </h3>
          <h3 style="text-align: center;">
            <span style="font-size: 16px;line-height:24px;"><a href = "https://mp.weixin.qq.com/s/dgZAPwhTPcn-zkmdGR2mQA" target="_blank">关于我院（赣州农业学校、江西赣州技师学院）部分专业招生录取情况的通告二</a></span>
          </h3>
        </div>

      </div>
      <div class="layui-tab-item <c:if test="${param.showTab eq 2}">layui-show</c:if>">

        <div class="layui-row">
          <style>
            .h2_m{
              margin: 27px 0px;
              font-weight: 900;
            }
          </style>
          <div class="layui-col-md6 layui-col-md-offset3" style="padding-right: 15px; text-align: center">
            <h2 class="h2_m">第一步：使用微信扫码</h2>
            <img src="./images/img1.png" style="width: 100%;">
            <h2  class="h2_m">第二步：在底部服务专区中可见“非税缴费”栏目，点击进入“教育缴费平台”；</h2>
            <img src="./images/img2.png" style="width: 100%;">
            <h2  class="h2_m">第三步：选择“高校教育缴费“</h2>
            <img src="./images/img3.png" style="width: 100%;">
            <h2  class="h2_m">第四步：选择学校“江西赣州技师学院或赣州农业学校”，输入学生本人的身份证号和验证号，即可交费。</h2>
            <h2 style="color: #ff0000;">提醒：身份证存在X字母，请使用大写</h2>
            <img src="./images/img4.png" style="width: 100%;">
            <h1 class="h2_m" >支付宝交学费的方法</h1>
            <h2 class="h2_m">第一步：在支付宝中扫码进入“教育缴费”专区；</h2>
            <img src="./images/img5.png" style="width: 100%;">
            <h2 class="h2_m">第二步：选择“大学”，输入“江西赣州技师学院”和学生本人的身份证号码，即可缴费。</h2>
            <img src="./images/img6.png" style="width: 100%;"><br>
            <img src="./images/img8.png" style="width: 100%;">

            <h1 class="h2_m" >查询或下载电子票</h1>
            <h2 class="h2_m">微信或支付宝以和缴费相同的方式进入，就可看到“已支付”标签卡，然后点击“查看电子票”，就可以下载电子票。</h2>
            <img src="./images/img9.jpg" style="width: 100%;">
          </div>
        </div>
      </div>

    </div>
  </div>

</div>

<!-- 引入 layui.js -->
<script src="<%=request.getContextPath()%>/component/layui27/layui.js"></script>
<script src="<%=request.getContextPath()%>/component/jquery.min.js"></script>
<script src="<%=request.getContextPath()%>/component/ajaxForm.js"></script>
<script>
    layui.use(['form', 'jquery','upload','element','layer'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let upload = layui.upload;
        var element = layui.element;
        let layer = layui.layer;
        let minScor = 0;
        let majorList=[];

        $("#idCard").on("change",function(){
            var idcard = $("#idCard").val()
            if(idcard.trim().length == 18){
                if (parseInt(idcard.substr(16, 1)) % 2 === 1) {
                    // return "男"
                    $("#sex").val("男")
                } else {
                    // return "女"
                    $("#sex").val("女")
                }

                // 获取年月日
                let birthday = idcard.substring(6, 10) + "-" + idcard.substring(10, 12) + "-" + idcard.substring(12, 14);
                $("#birthday").val(birthday);

            }
        })

        // 初始化层级
        window.initLevel = function(schoolId){
            var xueli = $("#xueli").val()
            $.ajax({
                url: 'common/queryLevelBySchoolId',
                dataType: 'json',
                data:{schoolId:schoolId},
                type: 'get',
                success: function (result) {
                    var inHtml = "<option>请选择</option>";
                    for(var i = 0;i < result.length; i++){
                        if(result[i].levelName == '三年高技' || result[i].levelName == '四年技师'){
                           if(xueli == '初中'){
                               continue;
                           }else{
                               inHtml = inHtml+"<option value='"+result[i].id+"'>"+result[i].levelName+"</option>"
                           }
                        }else{
                            if(xueli == '初中'){
                                inHtml = inHtml+"<option value='"+result[i].id+"'>"+result[i].levelName+"</option>"
                                continue;
                            }else{
                            }
                        }

                    }
                    $("#levelId").html(inHtml);
                    form.render('select'); //刷新select选择框渲染
                }
            })
        }

        window.searchBuild = function(){

            var bmxh = $("#searchBmxh").val();
            var idCard = $("#searchIdcard").val();

            if(bmxh.trim().length != 14){
                alert("报名序号错误！")
                return;
            }

            if(idCard.trim().length != 18){
                alert("身份证号错误！")
                return;
            }


            window.location.href='<%=request.getContextPath()%>/common/buildStatusPage?idCard='+idCard+'&bmxh='+bmxh

            <%--var w='';--%>
            <%--var h='';--%>
            <%--if (w == null || w == '') {--%>
                <%--w=($(window).width()*0.9);--%>
            <%--};--%>
            <%--if (h == null || h == '') {--%>
                <%--h=($(window).height() - 50);--%>
            <%--};--%>

            <%--layer.open({--%>
                <%--type: 2,--%>
                <%--title: '报名信息',--%>
                <%--shade: 0.1,--%>
                <%--area: [w+'px', h +'px'],--%>
                <%--content: '<%=request.getContextPath()%>/common/buildStatusPage?idCard='+idCard+'&bmxh='+bmxh--%>
            <%--});--%>
        }

        // 初始化专业
        window.initMajor = function(levelId){
            $.ajax({
                url: 'common/queryMajorByLevelId',
                dataType: 'json',
                data:{levelId:levelId},
                type: 'get',
                success: function (result) {
                    majorList = result;
                    var inHtml = "<option>请选择</option>";
                    for(var i = 0;i < result.length; i++){
                        inHtml = inHtml+"<option value='"+result[i].id+"'>"+result[i].majorName+"</option>"
                    }
                    $("#majorId").html(inHtml);
                    form.render('select'); //刷新select选择框渲染
                }
            })
        }

        window.initRegion = function(pid,idName){
            $.ajax({
                url: 'common/queryRegionByPid',
                dataType: 'json',
                data:{pid:pid},
                type: 'get',
                success: function (result) {
                    var inHtml = "<option>请选择</option>";
                    for(var i = 0;i < result.length; i++){
                        if(result[i].id == 3404){
                            inHtml = inHtml+"<option value='"+result[i].id+"' selected >"+result[i].name+"</option>"
                        }else{
                            inHtml = inHtml+"<option value='"+result[i].id+"'>"+result[i].name+"</option>"
                        }

                    }
                    $("#"+idName).html(inHtml);
                    form.render('select'); //刷新select选择框渲染
                }
            })
        }

        initLevel(1)

        initRegion(0,'province');
        initRegion(3404,'city');

        initRegion(0,'byProvince');
        initRegion(3404,'byCity');

        // initMajor(1)

        form.on('select(schoolId)', function(data){
            initLevel($("#schoolId").val())
        });
        form.on('select(levelId)', function(data){
            initMajor($("#levelId").val())
        });

        form.on('select(xueli)', function(data){
            var xueli = $("#xueli").val();
            if(xueli != '初中'){
                $("#zkfs_div").hide();
                $("#bmxhdiv").hide();
                $("#score").val("999");
                $("#graduateNo").val("99999999999999");
                $("#fsjt").html("<font color=\"red\">*</font>毕业证截图")
            }else{
                $("#zkfs_div").show();
                $("#bmxhdiv").show();
                $("#score").val("");
                $("#graduateNo").val("");
                $("#fsjt").html("<font color=\"red\">*</font>分数截图")
            }

            initLevel($("#schoolId").val())
        });

        form.on('select(majorId)', function(data){
            var majorId = $("#majorId").val();
            for(var i = 0; i< majorList.length;i++){
                if(majorId == majorList[i].id){
                    minScor = majorList[i].minScore;
                    $("#lxr").html(majorList[i].lxr)
                    if(majorList[i].bmrs > majorList[i].planNumber){
                        alert('报名人数已大于计划人数，可以报名，我们将按分数排名择优录取。');
                    }
                    break;
                }
            }
        });

        form.on('select(province)', function(data){
            initRegion($("#province").val(),'city')
        });

        form.on('select(city)', function(data){
            initRegion($("#city").val(),'prefecture')
        });

        form.on('select(byProvince)', function(data){
            initRegion($("#byProvince").val(),'byCity')
        });

        form.on('select(byCity)', function(data){
            initRegion($("#byCity").val(),'byPrefecture')
        });

        form.on('select(byPrefecture)', function(data){
            // 毕业学校
            $.ajax({
                url: 'common/queryBYSchool',
                dataType: 'json',
                data:{prefectureId:$("#byPrefecture").val()},
                type: 'get',
                success: function (result) {
                    var inHtml = "";
                    for(var i = 0;i < result.length; i++){
                        // inHtml = inHtml+"<option value='"+result[i].schoolName+"' >"+result[i].schoolName+"</option>"
                        inHtml = inHtml+"<option value='"+result[i].schoolName+"'>";
                    }
                    $("#schoolList").html(inHtml);
                    // form.render('select'); //刷新select选择框渲染
                }
            })
        });


        //执行实例
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            ,url: '/upload/' //上传接口
            ,accept:'images'
            ,acceptMime: 'image/*'
            ,done: function(res){
                //上传完毕回调
            }
            ,error: function(){
                //请求异常回调
            }
        });

        form.on('submit(*)', function(data){
            var grad = data.field.graduateNo;
            if(grad.length != 14){
                alert("请输入正确的报名序号");
                return false;
            }

            if(data.field.idCard.length != 18){
                alert("请输入正确的身份证号码。");
                return false;
            }

            if(data.field.prefecture == '请选择' || data.field.prefecture == ''){
                alert("请选择正确的省市县");
                return false;
            }

            if(data.field.majorId == '请选择' || data.field.majorId == ''){
                alert("请选择专业");
                return false;
            }

            if(data.field.score < minScor){
                alert("您的考试分数不满足该专业的最低分数。");
                return false;
            }
            // var index = layer.load();
            $("#ajaxForm").ajaxSubmit({
                type : 'post',
                url : "<%=request.getContextPath()%>/preRegist",
                dataType: 'json',
                //data:  //注意只要是写在表单里面的，都不需要加这个属性。在controller中可以根据@RequestParam String str获取到属性值。
                contentType : "application/x-www-form-urlencoded; charset=utf-8",
                success: function(result) {
                    alert(result.msg)
                },
                error: function (data)//服务器响应失败处理函数
                {
                    alert('返回数据不对')
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });

        $("#captchaImage").click(function(){
            document.getElementById("captchaImage").src="<%=request.getContextPath()%>/system/captcha/generate?"+Math.random();
        })

    });
</script>

</body>
</html>
